Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rollup of 12 pull requests #126016

Merged
merged 41 commits into from
Jun 5, 2024
Merged

Conversation

workingjubilee
Copy link
Member

Successful merges:

r? @ghost
@rustbot modify labels: rollup

Create a similar rollup

joshtriplett and others added 30 commits May 13, 2024 15:11
…relude

Many, many projects use `size_of` to get the size of a type. However,
it's also often equally easy to hardcode a size (e.g. `8` instead of
`size_of::<u64>()`). Minimizing friction in the use of `size_of` helps
ensure that people use it and make code more self-documenting.

The name `size_of` is unambiguous: the name alone, without any prefix or
path, is self-explanatory and unmistakeable for any other functionality.
Adding it to the prelude cannot produce any name conflicts, as any local
definition will silently shadow the one from the prelude. Thus, we don't
need to wait for a new edition prelude to add it.

Add `size_of_val`, `align_of`, and `align_of_val` as well, with similar
justification: widely useful, self-explanatory, unmistakeable for
anything else, won't produce conflicts.
Unlike static declarations with #[linkage], for definitions rustc
doesn't rewrite it to add an extra indirection.
Some of the bootstrap logics should be ignored during unit tests because they either
make the tests take longer or cause them to fail. Therefore we need to be able to exclude
them from the bootstrap when it's called by unit tests. This change introduces a new feature
called `bootstrap-self-test`, which is enabled on bootstrap unit tests by default. This allows
us to keep the logic separate between compiler builds and bootstrap tests without needing messy
workarounds (like checking if target names match those in the unit tests).

Signed-off-by: onur-ozkan <work@onurozkan.dev>
- Avoid unnecessary escaping of single quotes within string literals.
- Add a missing blank line between two `UNICODE_ARRAY` sections.
Lexing converts source text into a token stream. Parsing converts a
token stream into AST fragments. This commit renames several lexing
operations that have "parse" in the name. I think these names have been
subtly confusing me for years.

This is just a `s/parse/lex/` on function names, with one exception:
`parse_stream_from_source_str` becomes `source_str_to_stream`, to make
it consistent with the existing `source_file_to_stream`. The commit also
moves that function's location in the file to be just above
`source_file_to_stream`.

The commit also cleans up a few comments along the way.
It has a single call site.

This also means `CFG_ATTR_{GRAMMAR_HELP,NOTE_REF}` can be moved into
`parse_cfg_attr`, now that it's the only function that uses them.
And the commit removes the line break in the URL.
Because it takes an `Lrc<SourceFile>`, and for consistency with
`source_file_to_stream`.
It's a zero-value wrapper of `Parser::new`.
- Convert it from a macro to a function, which is nicer.
- Rename it as `unwrap_or_emit_fatal`, which is clearer.
- Fix the comment. In particular, `panictry!` no longer exists.
- Remove the unnecessary `use` declaration.
The first one is out-of-date -- there are no longer functions expr,
item, stmt. And I don't know what a "HOF" is.

The second one doesn't really tell you anything.
…_file`.

For consistency with `new_parser_from_{file,source_str}` and
`maybe_new_parser_from_source_str`.
It does exactly what is required.
All four functions are simple and have a single call site.

This requires making `Parser::parse_inner_attributes` public, which is
no big deal.
It's the only one of these functions where `psess` isn't the first
argument.
It has a single call site.
Currently we have an awkward mix of fallible and infallible functions:
```
       new_parser_from_source_str
 maybe_new_parser_from_source_str
       new_parser_from_file
(maybe_new_parser_from_file)        // missing
      (new_parser_from_source_file) // missing
 maybe_new_parser_from_source_file
       source_str_to_stream
 maybe_source_file_to_stream
```
We could add the two missing functions, but instead this commit removes
of all the infallible ones and renames the fallible ones leaving us with
these which are all fallible:
```
new_parser_from_source_str
new_parser_from_file
new_parser_from_source_file
source_str_to_stream
source_file_to_stream
```
This requires making `unwrap_or_emit_fatal` public so callers of
formerly infallible functions can still work.

This does make some of the call sites slightly more verbose, but I think
it's worth it for the simpler API. Also, there are two `catch_unwind`
calls and one `catch_fatal_errors` call in this diff that become
removable thanks this change. (I will do that in a follow-up PR.)
The `Input::File` and `Input::Text` cases should be very similar.
However, currently the `Input::File` case uses `catch_unwind` because,
until recently (rust-lang#125815) there was a fallible version of
`new_parser_from_source_str` but only an infallible version of
`new_parser_from_file`. This difference wasn't fundamental, just an
overlooked gap in the API of `rustc_parse`.

Both of those operations are now fallible, so the `Input::File` and
`Input::Text` cases can made more similar, with no need for
`catch_unwind`. This also lets us simplify an `Option<Vec<Diag>>` to
`Vec<Diag>`.
…anieu

Add `size_of` and `size_of_val` and `align_of` and `align_of_val` to the prelude

(Note: need to update the PR to add `align_of` and `align_of_val`, and remove the second commit with the myriad changes to appease the lint.)

Many, many projects use `size_of` to get the size of a type. However,
it's also often equally easy to hardcode a size (e.g. `8` instead of
`size_of::<u64>()`). Minimizing friction in the use of `size_of` helps
ensure that people use it and make code more self-documenting.

The name `size_of` is unambiguous: the name alone, without any prefix or
path, is self-explanatory and unmistakeable for any other functionality.
Adding it to the prelude cannot produce any name conflicts, as any local
definition will silently shadow the one from the prelude. Thus, we don't
need to wait for a new edition prelude to add it.
Make deleting on LinkedList aware of the allocator

Fixed rust-lang#125950
…trieb

Use inline const blocks to create arrays of `MaybeUninit`.

This PR contains 2 changes enabled by the fact that [`inline_const` is now stable](rust-lang#104087), and was split out of rust-lang#125082.

1. Use inline const instead of `unsafe` to construct arrays in `MaybeUninit` examples.

   Rationale: Demonstrate good practice of avoiding `unsafe` code where it is not strictly necessary.

4. Use inline const instead of `unsafe` to implement `MaybeUninit::uninit_array()`.

    This is arguably giving the compiler more work to do, in exchange for eliminating just one single internal unsafe block, so it's less certain that this is good on net.

r​? `@Nilstrieb`
…ble, r=oli-obk

Closures are recursively reachable

Fixes rust-lang#126012.
…iler-errors

Add a co-maintainer for the two ARMv4T targets

This adds a second maintainer to the `armv4t-none-eabi` and `thumbv4t-none-eabi` targets, a necessary step on the path to Tier 2
…-test, r=lcnr

Add another test for hidden types capturing lifetimes that outlive but arent mentioned in substs

Another test to make sure future implementations of rust-lang#116040 don't have any subtle unsoundness 🤔

r? types
@rustbot rustbot added A-testsuite Area: The testsuite used to check the correctness of rustc O-unix Operating system: Unix-like S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. T-bootstrap Relevant to the bootstrap subteam: Rust's build system (x.py and src/bootstrap) T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. T-libs Relevant to the library team, which will review and decide on the PR/issue. T-rustdoc Relevant to the rustdoc team, which will review and decide on the PR/issue. rollup A PR which is a rollup labels Jun 5, 2024
@workingjubilee
Copy link
Member Author

@bors r+ rollup=never p=12

@bors
Copy link
Contributor

bors commented Jun 5, 2024

📌 Commit f12fe3a has been approved by workingjubilee

It is now in the queue for this repository.

@bors
Copy link
Contributor

bors commented Jun 5, 2024

🌲 The tree is currently closed for pull requests below priority 101. This pull request will be tested once the tree is reopened.

@bors bors added S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Jun 5, 2024
@bors
Copy link
Contributor

bors commented Jun 5, 2024

⌛ Testing commit f12fe3a with merge db8aca4...

@bors
Copy link
Contributor

bors commented Jun 5, 2024

☀️ Test successful - checks-actions
Approved by: workingjubilee
Pushing db8aca4 to master...

@bors bors added the merged-by-bors This PR was explicitly merged by bors. label Jun 5, 2024
@bors bors merged commit db8aca4 into rust-lang:master Jun 5, 2024
7 checks passed
@rustbot rustbot added this to the 1.80.0 milestone Jun 5, 2024
@rust-timer
Copy link
Collaborator

📌 Perf builds for each rolled up PR:

PR# Message Perf Build Sha
#123168 Add size_of and size_of_val and align_of and `align_o… d291b485d483bb7f4b988661c41b30374b29f082 (link)
#125273 bootstrap: implement new feature bootstrap-self-test 6737249f93128291ef5696adce43154166a1a821 (link)
#125683 Rewrite suspicious-library, resolve-rename and `incr-pr… 715f600222552c9896f7c11fc8a8affa91e9812d (link)
#125815 rustc_parse top-level cleanups f5400f13e89a68a60140eed661dd388fc4dce1ea (link)
#125903 rustc_span: Inline some hot functions d76611fb2afaf71d4c5f199b0cb7bdd1c7cb6e96 (link)
#125906 Remove a bunch of redundant args from report_method_error 9e92f9cccf54c347af2cba726b58182ab4d2a222 (link)
#125920 Allow static mut definitions with #[linkage] 526235ea5265d6b4b923c6a308adf4efcdc3b97b (link)
#125982 Make deleting on LinkedList aware of the allocator 97827ca6d9c08859e7a6412cfae9c7c7ee30d90d (link)
#125995 Use inline const blocks to create arrays of MaybeUninit. e55c4389836f2b9a692fc345a2d0346a5f0ca9bc (link)
#125996 Closures are recursively reachable 7d730724c8480d2d3c254699a2b662cf0f6181de (link)
#126003 Add a co-maintainer for the two ARMv4T targets 811a33953fa0d755b65b20e8529572dd91e1f9bf (link)
#126004 Add another test for hidden types capturing lifetimes that … c7e00aeab42ab5c2f27e1be60deffa2a1092e2a5 (link)

previous master: 5ee2dfd2bc

In the case of a perf regression, run the following command for each PR you suspect might be the cause: @rust-timer build $SHA

@rust-timer
Copy link
Collaborator

Finished benchmarking commit (db8aca4): comparison URL.

Overall result: no relevant changes - no action needed

@rustbot label: -perf-regression

Instruction count

This benchmark run did not return any relevant results for this metric.

Max RSS (memory usage)

Results (primary 2.5%, secondary -5.9%)

This is a less reliable metric that may be of interest but was not used to determine the overall result at the top of this comment.

mean range count
Regressions ❌
(primary)
2.5% [2.5%, 2.5%] 1
Regressions ❌
(secondary)
- - 0
Improvements ✅
(primary)
- - 0
Improvements ✅
(secondary)
-5.9% [-5.9%, -5.9%] 1
All ❌✅ (primary) 2.5% [2.5%, 2.5%] 1

Cycles

Results (secondary -0.9%)

This is a less reliable metric that may be of interest but was not used to determine the overall result at the top of this comment.

mean range count
Regressions ❌
(primary)
- - 0
Regressions ❌
(secondary)
2.4% [2.4%, 2.4%] 1
Improvements ✅
(primary)
- - 0
Improvements ✅
(secondary)
-2.6% [-2.9%, -2.3%] 2
All ❌✅ (primary) - - 0

Binary size

This benchmark run did not return any relevant results for this metric.

Bootstrap: 669.008s -> 666.65s (-0.35%)
Artifact size: 318.95 MiB -> 318.96 MiB (0.00%)

@workingjubilee workingjubilee deleted the rollup-nh6ehbz branch June 5, 2024 16:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-testsuite Area: The testsuite used to check the correctness of rustc merged-by-bors This PR was explicitly merged by bors. O-unix Operating system: Unix-like rollup A PR which is a rollup S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. T-bootstrap Relevant to the bootstrap subteam: Rust's build system (x.py and src/bootstrap) T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. T-libs Relevant to the library team, which will review and decide on the PR/issue. T-rustdoc Relevant to the rustdoc team, which will review and decide on the PR/issue.
Projects
None yet
Development

Successfully merging this pull request may close these issues.